<div class="maintop">
    当前位置：资金帐变
    <a href="javascript:;" action="<?=$basepath?>?<?=$this->page_url($page_current,$page_url)?>" id="btn_refresh" class="mainFrame button">刷新</a>
    <? if(ISDEBUG){ ?>
        <a href="javascript:$('.debuginfo').toggle();" class="button">调试信息</a>
    <? } ?>
</div>
<div class="main-search">
    <table width="100%">

        <tbody><tr>
            <td>
                <form action="<?=$basepath?>" id="brandsSearch" method="get" target="ajax" dataType="html" onajax="beforeSearchForm" call="searchForm" container="#iframe" isLoad="true">
                    <select name="liqtype" style="width:80px">
                        <option value="">全部帐变</option>
                    <?php
                        foreach ($this->coin_type_data as $k=>$v){
                            echo '<option value="',$k,'">',$v,'</option>';
                        }
                    ?>
                    </select>
                    &nbsp;<select name="field">
                        <option value="">全部</option>
                        <option value="uno">玩家号码</option>
                        <option value="ex2">期数</option>
                        <option value="gameid">游戏ID</option>
                    </select>
                    <input type="text" id="sKey" name="sKey" class="int" placeholder="搜索关键字">
                    &nbsp;日期：从
                    <input id="fromTime" name="fromTime" type="text" class='Wdate' style='width:100px;' value="<?=$searchdata['fromTime']?date('Y-m-d',intval(strtotime($searchdata['fromTime']))):''?>" onFocus="WdatePicker({dateFmt:'yyyy-MM-dd',alwaysUseStartDate:true})"></input>&nbsp;至
                    <input id="toTime" name="toTime" type="text" class='Wdate' style='width:100px;' value="<?=$searchdata['toTime']?date('Y-m-d',intval(strtotime($searchdata['toTime']))):''?>" onFocus="WdatePicker({dateFmt:'yyyy-MM-dd',alwaysUseStartDate:true})"></input>&nbsp;&nbsp;
                    每页：
                    <select id="ps" name="ps">
                        <option value="12" <?php if($this->existsKeyInArray('ps',$searchdata,'N',$this->pagesize) == 12) echo 'selected';?> >12</option>
                        <option value="20" <?php if($this->existsKeyInArray('ps',$searchdata,'N',$this->pagesize) == 20) echo 'selected';?> >20</option>
                        <option value="30" <?php if($this->existsKeyInArray('ps',$searchdata,'N',$this->pagesize) == 30) echo 'selected';?> >30</option>
                        <option value="50" <?php if($this->existsKeyInArray('ps',$searchdata,'N',$this->pagesize) == 50) echo 'selected';?> >50</option>
                        <option value="100" <?php if($this->existsKeyInArray('ps',$searchdata,'N',$this->pagesize) == 100) echo 'selected';?> >100</option>
                    </select>
                    <input type="submit" value="搜索" class="upbutton">
                </form>
            </td>
        </tr>
        </tbody>

    </table>
</div>
<div id="mainbody">
    <table width="100%" class="tablist">
        <tr class="trbg">
            <th>No.</th>
            <th>玩家</th>
            <th>帐变说明</th>
            <th>发生金额</th>
            <th>玩家余额</th>
            <th width="140">日期时间</th>
        </tr>
        <? foreach($datas as $v){ ?>
            <tr>
                <td><?=$v['id']?></td>
                <td><a href="/members/members_list_edit?uid=<?=$v['uid']?>" title="编辑" class="colorbox"><?=$v['uno']?>【<?=$v['nickname']?>】</a></td>
                <td style="text-align:left"><?=(empty($v['gamename'])?'':$v['gamename'].' - ')?><?=$this->coin_type_data[$v['liqtype']]?><?=($v['ex2']?' - '.$v['ex2']:'')?><?=($v['ex3']?' - '.$v['ex3']:'')?></td>
                <td class="<?=$v['coin']>0?'green':'red'?>"><?=number_format($v['coin'],2,'.','') ?></td>
                <td class="<?=$v['usercoin']>0?'green':'red'?>"><?=number_format($v['usercoin'],2,'.','') ?></td>
                <td><?=$this->formatTimes($v['times'])?></td>
            </tr>
        <? } ?>
    </table>
    <? require VIEW.'/page.view.php' ?>
</div>
<script type="text/javascript">
    function beforeSearchForm(){
        var _key = this.sKey.value;
        if(_key.length<=0){
            //throw '搜索关键字不能为空';
        }
    }
    function searchForm(self, _html, data){
        $("#iframe").html(_html);
    }
    $(document).ready(function(){
        <?php
        if(!empty($searchdata['sKey'])){
            echo '$("#sKey").val("'.$searchdata['sKey'].'");';
        }
        if(!empty($searchdata['fromTime'])){
            echo '$("input[name=fromTime]").val("'.$searchdata['fromTime'].'");';
        }
        if(!empty($searchdata['toTime'])){
            echo '$("input[name=toTime]").val("'.$searchdata['toTime'].'");';
        }
        if(!empty($searchdata['liqtype'])){
            echo '$("select[name=\'liqtype\'] option[value=\''.$searchdata['liqtype'].'\']").attr("selected", "selected");';
        }
        if(!empty($searchdata['field'])){
            echo '$("select[name=\'field\'] option[value=\''.$searchdata['field'].'\']").attr("selected", "selected");';
        }
        ?>
        $(".colorbox").colorbox({ iframe: true,width:"80%",height:"80%" });
    });
</script>
